package cn.s1995.sloth.bizs.entity;

import cn.s1995.sloth.bizs.entity.base.BaseEntity;
import cn.s1995.sloth.common.core.convert.JoinUrlPrefixConvert;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import java.util.List;

/**
 * 用户反馈
 *
 * @author Lex
 * @date 2023-12-28 01:20:24
 */
@Data
@Accessors(chain = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(description = "用户反馈")
@TableName(value = "biz_user_feedback", autoResultMap = true)
public class UserFeedback extends BaseEntity {


	/**
	* ID
	*/
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "ID")
	@NotNull(groups = {BaseEntity.ValidGroup.Edit.class})
    private Long id;

	/**
	* 用户id
	*/
    @Schema(description = "用户id")
    private Long uid;

	/**
	* 类型：1.功能异常 2.建议优化 3.其他
	*/
    @Schema(description = "类型：1.功能异常 2.建议优化 3.其他")
	@NotNull(groups = {BaseEntity.ValidGroup.Add.class, BaseEntity.ValidGroup.Edit.class})
	@Range(min = 1, max = 3)
    private Integer type;

	/**
	* 邮箱
	*/
    @Schema(description = "邮箱")
	@Size(max = 255)
	@Email
    private String email;

	/**
	* 标题
	*/
    @Schema(description = "标题")
	@Size(max = 255)
    private String title;

	/**
	* 内容
	*/
    @Schema(description = "内容")
	@Size(max = 1024)
    private String content;

	/**
	 * 图片
	 */
	@Schema(description = "图片")
	@Size(max = 3)
	@JsonSerialize(using = JoinUrlPrefixConvert.class)
	@TableField(typeHandler = JacksonTypeHandler.class)
	private List<String> pics;

	/**
	* 来源：1.APP 2.H5 3.小程序
	*/
    @Schema(description = "来源：1.APP 2.H5 3.小程序")
	@Range(min = 1, max = 3)
    private Integer source;
}
